<?php 
/**
 * $Id: form.php 2 2010-10-07 14:19:09Z ahmtsari $
 * Item view for BF Auction Component
 *
 * @package    Joomla
 * @subpackage Components
 * @link http://www.tamlyncreative.com.au/software
 * @copyright	Copyright (c) 2010 - Tamlyn Creative Pty Ltd.
 * @license		GNU GPL
 *
 *	  BF Auction is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation, either version 3 of the License, or
 *    (at your option) any later version.
 *
 *    BF Auction is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *    GNU General Public License for more details.
 *
 *    You should have received a copy of the GNU General Public License
 *    along with BF Auction.  If not, see <http://www.gnu.org/licenses/>.
 *
 *
 * Author's notes: When GNU speaks of free software, it is referring to freedom, not price.
 * We encourage you to purchase your copy of BF Auction from the developer (Tamlyn Creative Pty Ltd),
 * so that we can continue to make this product better and continue to provide a high quality of support.
 *
 */
?>
<?php defined('_JEXEC') or die('Restricted access'); ?>

		<script language="javascript" type="text/javascript">
		<!--


		function submitbutton(pressbutton) {
			var form = document.adminForm;
			if (pressbutton == 'cancel') {
				submitform( pressbutton );
				return;
			}
			// do field validation
			if (form.title.value == "") {
				alert( "<?php echo JText::_( 'Please enter a title.', true ); ?>" );
			} else if ( getSelectedValue('adminForm','catid') == 0 ) {
				alert( "<?php echo JText::_( 'Please select a category.', true ); ?>" );
			} else {
				submitform( pressbutton );
			}
		}

		//-->
		</script>

<script language="javascript">
	function imposeMaxLength(Object, MaxLen)
	{
	  return (Object.value.length < MaxLen);
	}
</script>

<?php
// For popup help
JHTML::_('behavior.tooltip');
?>

<form action="index.php" method="post" name="adminForm" id="adminForm">
<div class="col width-65">
	<fieldset class="adminform">
		<legend><?php echo JText::_( 'Item Details' ); ?></legend>

		<table class="admintable">
		<tr>
			<td valign="top" align="right" class="key">
				<label for="catid">
					<?php echo JText::_( 'Category' ); ?>: *
				</label>
			</td>
			<td>
				<?php echo $this->lists['catid']; ?>
				&nbsp;<img src="./components/com_bfauction/images/con_info.png" class="hasTip" title="Category::This is the category that your item will appear in">
			</td>
		</tr>
		<tr>
			<td width="100" align="right" class="key">
				<label for="title">
					<?php echo JText::_( 'Title' ); ?>: *
				</label>
			</td>
			<td>
				<input class="text_area" type="text" name="title" id="title" size="60" maxlength="250" value="<?php echo $this->bfauction->title;?>"/>
			</td>
		</tr>
		<tr>
			<td width="100" class="key">
				<?php echo JText::_( 'Published' ); ?>:
			</td>
			<td>
			    <?php
			       if(!isset($this->bfauction->published)){
			          $this->bfauction->published=0;
			       }
			    ?>
				<?php echo JHTML::_( 'select.booleanlist',  'published', 'class="inputbox"', $this->bfauction->published ); ?>
			</td>
		</tr>
		<tr>
			<td class="key">
				<label for="description">
					<?php echo JText::_( 'Description' ); ?>:
				</label>
			</td>
			<td>
			   <img src="./components/com_bfauction/images/con_info.png" class="hasTip" title='Description::This is the description of the item. This field can contain HTML.'>
			</td>
		</tr>
		<tr>
			<td colspan=2>
			    <?php
			       if(!isset($this->bfauction->description)){
			          $this->bfauction->description = "";
			       }
			    ?>
			    <?php $editor = JFactory::getEditor(); ?>
				<?php echo $editor->display( 'description',  $this->bfauction->description, '500', '300', '60', '40', array()) ; ?>
			</td>
		</tr>

	</table>

	<input class="inputbox" type="hidden" name="ordering" id="ordering" size="6" value="<?php echo $this->bfauction->ordering;?>" />

	</fieldset>
</div>
<div class="col width-35">
	<fieldset class="adminform">
	<legend><?php echo JText::_( 'Options' ); ?></legend>
	<table class="admintable">

		<tr>
			<td class="key">
				<label for="currentBid">
					<?php if($this->isNew){ ?>
						<?php echo JText::_( 'Opening Bid' ); ?>: *
					<?php }else{ ?>
						<?php echo JText::_( 'Current Bid' ); ?>: *
					<?php } ?>	
				</label>
			</td>
			<td>
			    <?php
			       if(!isset($this->bfauction->currentBid)){
			          $this->bfauction->currentBid = 0;
			       }
			    ?>
			    <?php if($this->isNew){ ?>
			       <input class="inputbox" type="text" name="currentBid" id="currentBid" size="5" value="<?php echo $this->bfauction->currentBid;?>"/>
			    <?php }else{ ?>
			       <input class="inputbox" type="text" readonly name="currentBid" id="currentBid" size="5" value="<?php echo $this->bfauction->currentBid;?>"/> <i>(read only)</i>
			    <?php } ?>
			</td>
		</tr>
		<tr>
			<td class="key">
				<label for="highBidder">
					<?php echo JText::_( 'High Bidder' ); ?>: *
				</label>
			</td>
			<td>
			    <?php
			       if(!isset($this->bfauction->highBidder)){
			          $this->bfauction->highBidder = 0;
			       }
			    ?>
			    <input class="inputbox" type="text" readonly name="highBidder" id="highBidder" size="20" value="<?php echo $this->bfauction->highBidder;?>"/> <i>(read only)</i>
			</td>
		</tr>
		<tr>
			<td class="key">
				<label for="endTime">
					<?php echo JText::_( 'End Date & Time' ); ?>:
				</label>
			</td>
			<td>
			<?php
				$document = &JFactory::getDocument();
				$document->addScript("includes/js/joomla.javascript.js");

			    JHTML::_('behavior.calendar');

			    echo '<input class="inputbox" type="text" id="endDate" name="endDate" size="26" maxlength="25" value="'.$this->bfauction->endDate.'" />';
				echo '<input type="reset" class="button" value="..." onclick="return showCalendar(\'endDate\',\'%Y-%m-%d %H:%M:%S\');" /> ';
		    ?>
				&nbsp;<img src="./components/com_bfauction/images/con_info.png" class="hasTip" title="End Date::The date and time the auction ends, in the form YYYY-MM-DD HH:MM:SS">
			</td>
		</tr>
		<tr>
			<td width="100" align="right" class="key">
				<label for="itemLocation">
					<?php echo JText::_( 'Item Location' ); ?>:
				</label>
			</td>
			<td>
				<?php
			       if(!isset($this->bfauction->itemLocation)){
			          $this->bfauction->itemLocation = "";
			       }
			    ?>
			    <input class="inputbox" type="text" name="itemLocation" id="itemLocation" maxlength="255" size="30" value="<?php echo $this->bfauction->itemLocation;?>"/>
			    &nbsp;<img src="./components/com_bfauction/images/con_info.png" class="hasTip" title="Item Location::Where is this item current located.">
			</td>
		</tr>
		<tr>
			<td width="100" align="right" class="key">
				<label name="deliveryMethod">
				   <?php echo JText::_( 'Delivery Method' ); ?>:
				</label>
			</td>
			<td>
			    <?php
			       if(!isset($this->bfauction->deliveryMethod)){
			          $this->bfauction->deliveryMethod = "";
			       }
			    ?>
				<input class="inputbox" type="text" name="deliveryMethod" id="deliveryMethod" maxlength="255" size="30" value="<?php echo $this->bfauction->deliveryMethod;?>"/>
				&nbsp;<img src="./components/com_bfauction/images/con_info.png" class="hasTip" title="Delivery Method::How will this item be delivered once auction ends. Eg. Pickup">
			</td>
		</tr>
		
		<tr>
			<td width="100" class="key">
				<label name="image">
				   <?php echo JText::_( 'Image' ); ?>:
				</label>
			</td>
			<td>
			    <?php
			       if(!isset($this->bfauction->image)){
			          $this->bfauction->image = '';
			       }
			    ?>
				<input class="inputbox" type="text" name="image" id="image" maxlength="255" size="30" value="<?php echo $this->bfauction->image;?>"/>
				&nbsp;<img src="./components/com_bfauction/images/con_info.png" class="hasTip" title="Image::Type the relative path for the image eg. /images/mypic.jpg">
			</td>
		</tr>		
		
	</table>
	</fieldset>

</div>
<div class="clr"></div>

<input type="hidden" name="option" value="com_bfauction" />
<input type="hidden" name="id" value="<?php echo $this->bfauction->id; ?>" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="controller" value="question" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>